<?php
/**
 * IndexAction.class.php    后台管理中心首页操作类
 *
 * @author                  mashanling(msl-138@163.com)
 * @date                    2012-06-15 14:38:28
 * @last modify             2012-12-18 11:32:59 by mashanling
 */

!defined('ROOT') && exit('Access Denied');

class IndexAction extends CommonAction {//继承CommonAction by mashanling on 2012-07-02 10:11:37
    protected $auto_check_priv = false;//是否自动检测权限
    protected $init_model = false;//是否实例对应模型

    /**
     * 后台管理中心
     *
     * @author       mashanling
     * @date         2012-07-02 11:12:49
     * @last modify  2012-12-18 11:32:57 by mashanling
     *
     * @return bool 未登陆，返回false，否则返回true
     */
    function index() {

        if (!$admin_info = $this->admin_info) {
            $this->redirect('login');
            return false;
        }

        $admin_priv = strtolower(json_encode(array_values($this->role_info['priv'])));
        //css文件
        $css_file  = $this->loadTimeScript('START_TIME');
        $css_file .= css('extjs/resources/css/ext-all-gray.css,extjs/resources/css/ext-patch.css', IMGCACHE_JS);
        $css_file .= css('app.css');
        $js_file   = $this->loadTimeScript('LOAD_CSS_TIME');
        $js_file  .= js('');
        $js_file  .= $this->loadTimeScript('LOAD_EXT_TIME');
        $js_file  .= js('System.js', false, '/static/js/');
        $js_file  .= js(C('DEFAULT_LANG') . '.js', false, '/static/js/lang/') .
        //ext语言包
        (C('DEFAULT_LANG') != 'en' ? js('ext-lang-' . C('DEFAULT_LANG') . '.js', false, '/static/js/lang/') : '');

        if (APP_DEBUG) {
            $js_arr = array(//必须加载的js文件 by mashanling on 2012-07-10 16:27:43
                'util/common.js',
                'util/override.js',
                'util/App.History.js',
                'util/App.Application.js',
                'util/App.Field.js',//表单域 by mashanling on 2012-12-11 15:56:15
                'store/App.store.Admin.js',
                'store/App.store.Role.js',
                'store/App.store.Tree.js',
                'store/App.store.Area.js',//国家地区 by mashanling 22:05 2012-7-18
                'ux/App.ux.combo.Role.js',
                'ux/App.ux.TreePicker.js',//下拉树 by mashanling on 2012-08-02 18:25:52
                'ux/App.ux.Form.js',//表单 by mashanling on 2012-12-11 15:55:54
                'ux/App.ux.Grid.js',//列表 by mashanling on 2012-12-18 11:32:51
                'view/App.view.Viewport.js',
                'view/App.view.Tabs.js',
                'view/App.view.Index.js',
                'view/App.view.Center.js',
                'view/App.view.Header.js',
                'view/App.view.Tree.js',
                'controller/App.controller.Common.js',//通用控制器 by mashanling on 2012-07-28 09:04:24
                'controller/App.controller.Tree.js',
                'controller/App.controller.Tabs.js',
                'controller/App.controller.Index.js',
                'controller/App.controller.Login.js'
            );

            $js_file .= js($js_arr, false, IMGCACHE_JS . 'app/');
        }
        else {
            $js_file .= js('app/pack/app.js', false);
        }

        $js_file  .= $this->loadTimeScript('LOAD_JS_TIME');

        include(C('TEMPLATE_NAME'));

        return true;
    }
}